</div>

<div class="container">

    <!-- 为ECharts准备一个具备大小（宽高）的Dom -->
    <div id="main" style="height:400px"></div>
    <!-- ECharts单文件引入 -->
    <script src="http://echarts.baidu.com/build/dist/echarts.js"></script>
    <script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>
    <script type="text/javascript">
        //

        data1 = [];
        data2 = [];

        var url = '/index.php/admin/getdormdata';
        $.get(url,function(data, status)
        {
          console.log("Receiving server data...\n Data: " + data + "\nStatus: " + status);
          if (status == 'success')
          {
            jsn = $.parseJSON(data);
            $.each(jsn.items, function(name,value) {
                if (0==value.dorm)
                    data1.push("其它");
                else data1.push(value.dorm+"号楼");
                data2.push(value.count);
              //row = value.id + " " + value.fatherId + " " + value.name;
            });




        // 路径配置
        require.config({
            paths: {
                echarts: 'http://echarts.baidu.com/build/dist'
            }
        });
        
        // 使用
        require(
            [
                'echarts',
                'echarts/chart/bar', // 使用柱状图就加载bar模块，按需加载
                'echarts/chart/line' // 使用柱状图就加载bar模块，按需加载
            ],
            function (ec) {
                // 基于准备好的dom，初始化echarts图表
                var myChart = ec.init(document.getElementById('main')); 
                //data1 = ["衬衫","羊毛衫","雪纺衫","裤子","高跟鞋","袜子"];
                //data2 = [5, 20, 40, 10, 10, 20];
                //data1 = [];
                //data2 = [];
                //for (var i = 1;i<28;i++)
                //{
                //    data1.push(i+"号");   
                //    data2.push(i);
                //}
                //data1.push("其它");
                
                var option = {
                    tooltip: {
                        show: true
                    },
                    legend: {
                        data:['订单数']
                    },
                    xAxis : [
                        {
                            type : 'category',
                            data : data1
                        }
                    ],
                    yAxis : [
                        {
                            type : 'value'
                        }
                    ],
                    series : [
                        {
                            "name":"订单数",
                            "type":"bar",
                            "itemStyle" : { normal: {label : {show: true, position: 'top'}}},
                            "data": data2
                        }
                    ]
                };
        
                // 为echarts对象加载数据 
                myChart.setOption(option); 
            }
        );
          }
          else
          {
            console.warn("获取楼栋信息失败，请重试：）");
            return;
          }
        });
    </script>

</div>